const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
  transpileDependencies: true,
  publicPath: './',
  outputDir: 'dist/build/h5',
  assetsDir: '', // 资源直接在根目录
  chainWebpack: config => {
    // JS 输出到 js/
    config.output
      .filename('js/[name].[contenthash:8].js')
      .chunkFilename('js/[name].[contenthash:8].js')
    // 图片等静态资源输出到 img/，兼容webpack5 asset modules
    config.module
      .rule('images')
      .set('generator', {
        filename: 'img/[name].[hash:8][ext]'
      })
  }
})